const refreshRem = () => {
  try {
    const html = document.documentElement;
    const nearBy = document.getElementById('nearby-branch-wrapper');
    if (nearBy) {
      const designSize = 375;
      const wW = html.clientWidth;
      const rem = (wW * 100) / designSize;
      document.documentElement.style.fontSize = `${rem}px`;
      document.body.style.fontSize = '12px';
    }
  } catch (error) {
  }
};

let tid: any;
function handleResize() {
  clearTimeout(tid);
  tid = setTimeout(refreshRem, 300);
}
function bindViedEvent() {
  removeEvent()
  window.addEventListener('resize', handleResize, false);
  window.addEventListener('pageshow', handleResize, false);
  refreshRem();
}
function removeEvent() {
  window.removeEventListener('resize', handleResize, false);
  window.removeEventListener('pageshow', handleResize, false);
}

bindViedEvent()